<template>
  <div class="zong">
    <div class="geci">
      <div class="header">
        <div @click.stop="
        $router.go(-1)
    ">
          <img class="xia" src="../img/xia.png" alt="" />
        </div>
        <div class="text">
          <div class="text1">
            {{ song.al.name }}
          </div>
          <div class="text2">
            <span v-for="item in song.ar" :key="item.id">
              {{ item.name }}
            </span>
          </div>
        </div>
        <div class="touxiangpanent">
          <img class="touxiang" :src="song.al.picUrl" alt="" />
        </div>
      </div>
      <div class="textContext">
        <div class="centerGeci" v-for="item in geci" :key="item.id" >
          <div   class="box1">
            <img class="imgsolid" src="../img/bofangs.png" alt="" />
          </div>
          <div class="geciColor">
            {{ item[1] }}
          </div>
          <div class="geciColors">
            {{ splitss(item[0].split("[")[1]) }}
          </div>
        </div>
      </div>
      <div class="bomNav">
        <div>
          <img class="daxiao" src="../img/xunhuan.png" alt="" />
        </div>
        <div>
          <img class="daxiao" src="../img/shangyisou.png" alt="" />
        </div>
        <div>
          <div>
            <img
              v-if="paused"
              class="bofang"
              @click.stop="$emit('pause-audio', false)"
              src="../img/zantings.png"
              alt=""
            />
            <img
              v-else
              class="bofang"
              @click.stop="$emit('play-audio', true)"
              src="../img/bofangs.png"
              alt=""
            />
          </div>
        </div>
        <div>
          <img class="daxiao" src="../img/xiayishou.png" alt="" />
        </div>
        <div>
          <img class="daxiao" src="../img/liebiao.png" alt="" />
        </div>
      </div>
    </div>
    <!-- <div class="bgImgss"><img :src="song.al.picUrl" alt="" /></div> -->
  </div>
</template>

<script>
export default {
  props: {
    paused: Boolean,
    song: Object,
  },
  data() {
    return {
      geci: null,
    };
  },
  created() {
    this.$axios
      .get(`http://localhost:3000/lyric?id=${this.song.id}`)
      .then((res) => {
        let context = res.data.lrc.lyric.split("\n");
        let contexts = context.map((e) => e.split("]"));

        this.geci = contexts;
      });
  },
  methods: {
    splitss(s) {
      return s == undefined ? s : s.substring(0, 5);
    },
    
  },
};
</script>

<style lang="scss" scoped>
.geci {
  padding-top: 10rem;
  width: 375rem;
  height: 667rem;
  background-color: rgb(241, 7, 7);
  .textContext {
    height: 500rem;
    overflow: scroll;
    .centerGeci {
      display: flex;
      text-align: center;
      margin-top: 7rem;
      .box1 {
        width: 50rem;
        display: none;
        .imgsolid {
          width: 30rem;
          height: 30rem;
        }
      }
      .geciColor {
        width: 100%;
        color: #f4f4f4;
      }
      .geciColors {
        display: none;
        width: 50rem;
      }
    }
  }

  .header {
    display: flex;
    div {
      div {
        width: 100%;
      }
      width: 33%;
      text-align: center;
      .xia {
        width: 30rem;
        height: 30rem;
        margin-top: 5rem;
      }

      .text1 {
        width: 100%;
        text-align: center;
        color: #fff;
      }
      .text2 {
        width: 100%;
        text-align: center;
        color: rgb(151, 149, 149);
      }
      .touxiang {
        width: 40rem;
        height: 40rem;
        border-radius: 50%;
      }
    }
    :nth-child(1) {
      text-align: left;
      padding-left: 10rem;
    }
    .text {
      margin-left: -10rem;
      font-size: 17rem;
      text-align: center;
    }
    :nth-child(3) {
      text-align: right;
      padding-right: 10rem;
    }
  }
  .bomNav {
    width: 375rem;
    position: fixed;
    bottom: 10rem;
    left: 0;
    display: flex;
    div {
      width: 20%;
      height: 60rem;
      text-align: center;

      .daxiao {
        margin-top: 15rem;
        width: 30rem;
        height: 30rem;
      }

      &:nth-child(3) {
        div {
          width: 40rem;
          height: 40rem;
          margin: 0 auto;
          border: 2px solid #fff;
          border-radius: 50%;
          margin-top: 9rem;
          .bofang {
            width: 20rem;
            height: 20rem;
            margin-top: 10rem;
          }
        }
      }
    }
  }
}
</style>